<?php
require_once('../../config.php');
Doctrine::loadModels('../../models');

if( $_REQUEST["subject_id"]) 
{
    $subject_id = strip_tags($_REQUEST["subject_id"]);
    $agent_id = strip_tags($_REQUEST["agent_id"]);
	$title = strip_tags($_REQUEST["title"]);
    $message = strip_tags($_REQUEST["message"]);
	$rating_id = strip_tags($_REQUEST["rating_id"]);
	$message_is_public = strip_tags($_REQUEST["message_is_public"]);
	$message_is_comment = strip_tags($_REQUEST["message_is_comment"]);
	$parent_message_id = strip_tags($_REQUEST["parent_message_id"]);
	
	file_put_contents  ( "insert_params.txt", 
		$subject_id."/".$agent_id."/".$message."/".$rating_id."/".$message_is_public."/".$message_is_comment."/".$parent_message_id);
	
	$agentMessage = new AgentMessage();
	
	$agentMessage->subject_id = $subject_id;
	$agentMessage->title = $title;
	$agentMessage->agent_id = $agent_id;
	$agentMessage->rating_id = $rating_id;
	$agentMessage->message = $message;
	$agentMessage->message_is_public = $message_is_public;
	$agentMessage->message_is_comment = $message_is_comment;
	$agentMessage->parent_message_id = $parent_message_id;
	$agentMessage->created = date ("Y-m-d H:m:s");
	$agentMessage->modified = date ("Y-m-d H:m:s");
	/*
	$communication->created_by = $created_by;
	$communication->modified_by = $modified_by;
	*/	

	$agentMessage->save();
		
}

?>